<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <3>人的对象:firstname姓,lastname名,age年龄,fullName1()方法</3>
    <3>动态添加:address地址(属性)，fullName2()(函数)</3>
    <script>
        var person={
            firstname:"陈",
            lastname:"强",
            age:18,
            fullName1:function(){
                //函数里不能直接访问对象属性，加this关键字
                return this.firstname+this.lastname;
            }
        }
        console.log(person);
        console.log(person.firstname);
        console.log(person.age);
        console.log(person.fullName1());

        //动态添加
        person.address="废都西安";
        person.fullName2=function(){
           return person.firstname+person.lastname+","+person.age
        }
         console.log(person)
         console.log(person.firstname);
    </script>
</body>
</html>